
#include "gmatlab.h"
#include <stdio.h>

// void g_object_matlab_release(GObject *obj);
void mexFunction(int nlhs, mxArray *lhs[], int nrhs, const mxArray *rhs[])
{
  GObject *obj;

  // Check and convert arguments
  if (nrhs != 1) g_matlab_error("gmatlab:numArg", "g_object_matlab_release() takes 2 arguments");
  if (nlhs != 0) g_matlab_error("gmatlab:numRet", "g_object_matlab_release() has 1 return value");
  if (mxGetNumberOfElements(rhs[0]) != 1) g_matlab_error("gmatlab:badArray", "g_object_matlab_release() Arg 1 must have one element");
  if (mxGetClassID(rhs[0]) != MX_GPOINTER)
    g_matlab_error("gmatlab:badArray", "g_object_matlab_release() Arg 1 must be int, not %s", mxGetClassName(rhs[0]));
  obj = ((gpointer*)mxGetData(rhs[0]))[0];
  
  // Call function
  TRACE("g_object_matlab_release(%ld)", obj);
  if (obj) g_object_matlab_remove_toggle_ref(obj);
  
  // Prepare return value

}
